import sqlite3

# 连接数据库
conn = sqlite3.connect('example.db')
cursor = conn.cursor()

# 创建表
cursor.execute('''CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)''')

# 插入数据
cursor.execute("INSERT INTO users (name) VALUES ('Alice')")

# 提交更改
conn.commit()

# 查询数据
cursor.execute("SELECT * FROM users")
print(cursor.fetchall())

# 关闭连接
conn.close()